package controller;

import entities.CD;
import entities.Persoon;
import entities.Uitlening;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.List;
import ui.UI;

public class Controller implements java.io.Serializable {

  private transient UI ui = null;
  private List koekje;

  public Controller() {
  }

  public void setUI(UI ui) {
    this.ui = ui;
  }

  public void maakPersoon(String naam) {
  }

  //public List getPersonen() { }
  public void maakCD(String artiest, String titel) {
  }

  //public List getCDs() { }
  public void maakUitlening(Persoon p, CD cd, String Datum) {
  }

  //public List getUitleningen(){}
  public List getUitleningVanPersoon(Persoon p) {
    return koekje;
  }

  public Uitlening getUitleningVanCD(CD cd) {
    return new Uitlening();
  }

  public void verwijderUitlening(Uitlening uit) {
  }

  public void saveAll() {
    try {
      // Write to disk with FileOutputStream
      FileOutputStream f_out = new FileOutputStream("myobject.data");

// Write object with ObjectOutputStream
      ObjectOutputStream obj_out = new ObjectOutputStream(f_out);

// Write object out to disk
      obj_out.writeObject(this);

    } catch (Exception e) {
      e.printStackTrace();
    }

  }

  public static Controller restore() {
    return new Controller();
  }
}

